<?php
//require '../Utils/functions.php';

session_start();

//print_r($_SESSION);

if(isset($_GET['url'])){
	$url = $_GET['url'];
	$action = "../controller/loginController.php?action=logar&url=".$url;
}
else{
	$action = "../controller/loginController.php?action=logar";
}

//verifica se o usuario esta logado
if(isset($_SESSION["s_usuario_logado_type"]) && $_SESSION["s_usuario_logado_type"] != "" ){
	$type = $_SESSION["s_usuario_logado_type"];
	
	
	
	redirectTo("index.php");
	
	
}else{
	
}



?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
<link href="blueprint/screen.css" rel="stylesheet" type="text/css" media="all" />
<link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/login.css" rel="stylesheet" type="text/css" media="all" />
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.js" ></script>
<script src="js/functions.js"></script>





<!--[if lte IE 6]> 
<script src="js/DD_belatedPNG_0.0.8a.js" type="text/javascript"></script> 
<script type="text/javascript"> 
DD_belatedPNG.fix('.png_bg, img'); 
</script> 
<![endif]-->
<script type="text/javascript">
$().ready(function() {
	
	$("#form_login").validate({
		errorClass: "warning",
		rules: {
			usuario: {
				required: true,
				minlength: 3
			},
			senha: {
				required: true,
				minlength: 3
			},
			
		},
		messages: {
			usuario:{
                    required: "Por favor informe seu usuário.",
                    minlength: "O campo usuario deve conter no mínimo 3 caracteres."
                },
			senha:{
                    required: "Por favor informe sua senha.",
                    minlength: "O campo senha deve conter no mínimo 3 caracteres."
                }			
		}
	});
	
});
</script>
<?php //include_once 'inc/analytics_inc.php';?>
</head>

<body>
	<div id="wrapper" class="container">
	
    <div id="logonew" align="center">
        <img src="images/logo_sistema.png" alt="Protocolo Online - Acesso restrito" />
    </div>

	<?php //include_once 'inc/header_inc.php';?>
		<div id="content_login">
			<!--         	<img src="logo-login.png" alt="Portal do Aluno - Acesso restrito" /> -->
			
			
			
            <?php
			if(isset($_SESSION["mensagem_erro"])){
				$msg = $_SESSION["mensagem_erro"];				
				
			?>
			<script type="text/javascript" language="javascript">  
	$().ready(function() {
      $("#form_login").effect("shake", { times:4 }, 100);
  });
  </script>
			
            <div id="msg_error">
            	<h3><?php echo $msg; ?></h3>           
            </div>            
            <?php
            //apaga a msg da sessao
            unset($_SESSION["mensagem_erro"]);
			}
			?>
            
            <?php
			if(isset($_SESSION["mensagem"])){
				$msg = $_SESSION["mensagem"];				
				
			?>
            <div id="msg">
            	<h3><?php echo $msg; ?></h3>            
            </div>            
            <?php
            //apaga a msg da sessao
            unset($_SESSION["mensagem"]);
			}
			?>
        	<form id="form_login" class="jqtransform" action="<?php echo $action ?>" method="post">
            	
            	<div class="rowElem">               
                	<label for="login">Usu&aacute;rio</label>
                	<input type="text" id="login" name="usuario" />
                </div>
                <div class="rowElem">
                	<label for="senha">Senha</label>
                	<input type="password" id="senha" name="senha" />
                </div>
                <br />
                <div class="rowElem button_bar">
                	<input type="submit" value="Enviar" name="enviar"/>
                	<input type="reset" value="Cancelar" name="cancelar"/>
                </div>                            
                           
            </form>
            <!--<a href="recuperar_senha.php" id="recupera_senha" title="Clique aqui para recuperar sua senha">Recuperar senha (somente para alunos)</a>-->
        </div>
		
		
		
		
        <div id="footer" style="text-align: center;margin-top: 20px;">
            Desenvolvido por<br>
            <img src="images/developers.png">
        </div>
    
    </div>

</body>
</html>
